The present invention relates to an image filter circuit and an image filtering method, and more particularly, to an image filter circuit and an image filtering method for eliminating isolated dot noise from a digital image.
As a nonlinear filter to eliminate spike-like isolated dot noise in an image, a median filter is known.
In use of median filter, an arbitrary-sized matrix is generated around a pixel of interest in an original image, then pixel values within the matrix are sorted from the greatest value, and the value of the pixel of interest is replaced with an median pixel value.
Hereinbelow, a general median filter will be described in detail with reference to FIGS. 2 and 3.
As shown in FIG. 2, filtering processing can be performed on all the pixels of original image by sequentially moving the matrix in a horizontal or vertical direction.
FIG. 3 shows the circuit construction realizing the median filter. That is, to realize the median filter as a circuit, comparator circuits and selector circuits are prepared in correspondence with the number of sorting-comparison operations, and these circuits are sequentially combined so as to construct a network (comparator network).
For example, xe2x80x9cSorting and Searching, The Art of Computer Programmingxe2x80x9d by Donald Ervin Knuth, pp.220-246 discloses a technique to realize the sorting processing on an Mxc3x97M (M is a natural number) sized matrix with comparator circuits, switching circuits and data latches.
According to the sorting technique, if M=3 holds, for example, 25 comparators and 25 selectors and 72 data latches construct a median filter circuit. Note that to realize the median filter circuit as a digital clock-synchronous type median filter circuit, further 90 data latches and 3 loaded data latches are required.
Further, if M=4 holds, to construct the median filter circuit, 54 comparators and 54 selectors, 176 data latches and loaded data latches are required.
In this manner, to realize the median filter as hardware by the above technique, as the M value of the matrix to be processed increases, the circuit scale radically increases.
For example, to construct the median filter circuit with M=7 matrix size, if the median filter circuit is constructed as a digital circuit for interdata clock synchronization, the circuit scale is so large that the circuit cannot be realized without difficulty.
Further, Japanese Patent Laid-Opened No. 5-233802 discloses a technique to construct a median filter by generating a pixel value table without sorting processing by the comparators. However, as the particular method of the processing and hardware implementability are not disclosed, the technique is not realistic.
The present invention has been proposed to solve the conventional problems, and has its object to provide an image filter circuit and an image filtering method for realizing a large-scale nonlinear filter as a digital circuit.
According to the present invention, the foregoing object is attained by providing an image filter circuit which moves a pixel matrix on an original image, replaces a value of pixel of interest in the pixel matrix with a pixel value of predetermined rank in ascending order within the matrix, and outputs the pixel value of the predetermined rank, comprising: first histogram generation means for generating a first histogram with upper bit data of pixels constructing the pixel matrix; first search means for searching for a class including a pixel value corresponding to the predetermined rank in ascending order, as a target class, based on the first histogram; second histogram generation means for generating a second histogram with lower bit data of pixels included in the target class; and second search means for searching for the pixel value of the predetermined rank in ascending order based on the second histogram.
In accordance with the present invention as described above, two-step search is performed with respect to high-bit histogram and lower-bit histogram of pixels within the pixel matrix, thereby a pixel value of a predetermined rank in ascending order within the matrix can be detected.
As the image filter circuit has the above construction, even if the matrix size increases, the increase in circuit scale is suppressed to that approximately in proportion to the matrix size. Accordingly, the circuit scale does not radically increase. That is, according to the present invention, a large-scale nonlinear filter to eliminate isolated dot noise in an image can be realized as a digital circuit.
Another object of the present invention is to provide an image filter circuit and an image filtering method enabling increase in circuit scale in accordance with increase in matrix size by a simple structure.
According to the present invention, the foregoing object is attained by providing the image filter circuit, wherein the first and second delay passes respectively have a flip-flop array corresponding to the number of the new pixels.
As the image filter circuit has the above construction, the increase in circuit scale can be realized by simply inserting the flip-flop array, thereby high-speed filtering processing can be performed while data sequence can be maintained.
Other features and advantages of the present invention will be apparent from the following description taken in conjunction with the accompanying drawings, in which like reference characters designate the same name or similar parts throughout the figures thereof.